<?php
//edit
?>
<form method="post" action="<?=env('REQUEST_URI')?>">
<h3>Edit Member Information</h3>
<?php

if (in_array($current_user['auth_type'],array(AUTH_ADMIN,AUTH_PROD))) {
  echo '<p>' . $html->link('Edit Producer Information','/members/editProducer/' . $this->data['Member']['member_id']) . '</p>';
}

?>
<?php echo $form->hidden('Member.member_id');?>
<p class="required">Required Info</p><fieldset>
<legend>Personal Info</legend>
<?php echo $form->input('Member.first_name');?>
<?php echo $form->input('Member.last_name');?>
<?php echo $form->input('Member.email_address');?>
<?php echo $form->input('Member.home_phone');?>
<?php echo $form->input('Member.work_phone');?>
<?php echo $form->input('Member.mobile_phone');?>
<?php echo $form->input('Member.fax');?>
</fieldset>
<fieldset>
<legend>Alternate Contact (all optional)</legend>
<?php echo $form->input('Member.first_name_2');?>
<?php echo $form->input('Member.last_name_2');?>
<?php echo $form->input('Member.email_address_2');?>
</fieldset>
<fieldset>
<legend>Home Address</legend>
<?php echo $form->input('Member.address_line1');?>
<?php echo $form->input('Member.address_line2');?>
<?php echo $form->input('Member.city');?>
<?php echo $form->input('Member.state');?>
<?php echo $form->input('Member.zip');?>
<?php echo $form->input('Member.county');?>
</fieldset>
<fieldset>
<legend>User Information</legend>
<?php
	if($current_user['auth_type']==AUTH_ADMIN){
?>
<?php echo $form->input('Member.auth_type', array('options'=> array(
  'member'=>'Member',
  'producer'=>'Producer',
  'rtemanager'=>'Route Manager',
  'cashier'=>'Cashier',
  'administrator'=>'Administrator'
),'value'=>$this->data['Member']['auth_type']));
	} else {
    echo $form->hidden('Member.auth_type');
  }?>
<?php if($current_user['auth_type']!=AUTH_ADMIN){
  echo $this->data['Member']['username'];
  echo $form->hidden('Member.username');
}else{
	echo $form->input('Member.username');
}?>
<!-- put password stuff here -->
<p><?php echo $html->link('Change Password...','/members/changePassword/' . $this->data['Member']['member_id']);?></p>
</fieldset>
<fieldset>
<legend>Account Information</legend>
<?php 
  echo $form->input("Member.no_postal_mail", array('label'=>"Don't send me postal mail"));
?>
<?php 
  echo $form->input("Member.no_email", array('label'=>"Don't send me email")), "\n";
?>
<?php
  echo $form->input("Member.volunteer", array('label'=>"I am available to volunteer")), "\n";
  echo $form->hidden("Member.membership_date");			 
  if($current_user['auth_type']==AUTH_ADMIN){
  	echo $form->input("Member.votes", array('label' => "Voting Member")), "\n";
   	echo $form->input("Member.board_mem"), "\n";
    if($current_user['auth_type']!=AUTH_ADMIN){
      echo '<p>Membership fee: $' . $this->data['Member']['memb_amt_owed'] . '/year</p>';
      echo $form->hidden("Member.memb_amt_owed"), "\n";
    }else{	
      echo $form->input("Member.memb_amt_owed", array('label'=>"Annual Membership Fee")), "\n";
    }
  	echo $form->input("Member.email_invalid"), "\n";
  }
  if($current_user['auth_type']==AUTH_ADMIN){
    echo $form->input('Member.membership_discontinued'), "\n";
    echo $form->input('Member.banned'), "\n";
    echo $form->input('Member.ban_reason'), "\n";
	}
	
	 ?>
</fieldset>
<!--<input name='reset' type='reset' value='Clear form'>-->
<?php echo $form->submit('Update!'); ?>
</form>
<!--<pre>
<?php 
  //print_r($this->data); 
?>
</pre>-->